package com.shixi.shixitraining.shixitraining.ui.tabmine.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import com.shixi.shixitraining.shixitraining.ui.tabmine.fragment.CollectEmploymentFragment;
import com.shixi.shixitraining.shixitraining.ui.tabmine.fragment.CollectTrainFragment;
import com.shixi.shixitraining.shixitraining.ui.tabmine.fragment.CollectTrainingFragment;

/**
 * Created by shenyan on 2018/7/26.
 */

public class MyCollectPagerAdapter extends FragmentPagerAdapter {

    private String titles[] = {"实训项目","就业岗位","职业培训"};

    public MyCollectPagerAdapter(FragmentManager fm) {
        super(fm);
    }


    Fragment fragment = null;
    @Override
    public Fragment getItem(int position) {
        if (titles[position].equals("实训项目")){
            fragment=new CollectTrainingFragment();
        }else if (titles[position].equals("就业岗位")){
            fragment=new CollectEmploymentFragment();
        }else if (titles[position].equals("职业培训")){
            fragment=new CollectTrainFragment();
        }

        return fragment;

    }

    @Override
    public int getCount() {
        return titles.length;
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return titles[position];
    }
}
